<?php
namespace app\index\controller;
use app\index\model\Admin;
use app\index\model\User;
use think\Controller;
use think\Request;


class Login extends Controller {
    public function login() {
        return $this->fetch();
    }
    public function loginCheck(Request $request) {
        $data = $request->post();
        $login = new Admin();
        $res = $login->check($data);
        if($res) {
            session('username',$data['username']);
            $this->success('登陆成功','index/index/index');
        }else {
            $this->error('登陆失败');
        }
    }

}